<div class="container_8 clearfix">                
	<!-- Main Section -->
	<section class="main-section grid_8">
		<!-- Forms Section -->
		<div class="main-content grid_8 alpha">
			<header>
				<ul class="action-buttons clearfix fr">
					<li><a class="modalInput" rel="#simpledialog" href="<?php echo $this->url->action("index")?>">Danh mục tin tức</a></li>
				</ul>
				<h2>Thêm mới tin tức</h2>
			</header>
			<section class="clearfix">
				<?php echo $this->html->beginForm("create",array('class'=>"form"))?>
					<?php $this->html->enableClientSideValidation()?>
					<div class="clearfix">
						<?php $this->html->labelFor("categoryID") ?>
						<select name="categoryID">
							<?php foreach ($this->arrCategories as $category){
							if ($category['parentID'] == 0)
							{
							?>
								<option value="<?php echo $category['id']?>" style="font-weight: bold;"><?php echo $category['name']?></option>
							<?php 
							}
							else 
							{
							?>
								<option value="<?php echo $category['id']?>">.....<?php echo $category['name']?></option>
							<?php 
							}
							}
							?>
						</select>
					</div>
					<div class="clearfix">
						<?php $this->html->labelFor("title") ?>
						<?php $this->html->textboxFor("title", array("style" => "width: 310px;")) ?>
						<?php $this->html->validationMessageFor("title")?>
					</div>
					<div class="clearfix">
						<?php $this->html->labelFor("header") ?>
						<?php $this->html->textareaFor("header", array("style" => "width: 310px; height: 100px;")) ?>
						<?php $this->html->validationMessageFor("header")?>
					</div>
					<div class="clearfix">
						<?php $this->html->labelFor("avatar") ?>
						<?php $this->html->textboxFor("avatar") ?>
						<button class="button button-gray" type="button" onclick="return openGallery('avatar');">Duyệt</button>
						<?php $this->html->validationMessageFor("avatar")?>
					</div>
					<div class="clearfix">
						<?php $this->html->labelFor("content") ?>
						<?php $this->html->textareaFor("content") ?>
					</div>
					<div class="action clearfix" style="padding-top: 20px;">
						<button class="button button-gray" type="submit"><span class="accept"></span>Thêm mới</button>
						<button class="button button-gray" type="reset">Làm lại</button>
					</div>
				<?php echo $this->html->endForm();?>
			</section>
		</div>
		<!-- End Forms Section -->
		<div class="clear"></div>
	</section>
    <!-- Main Section End -->
</div>
<script type="text/javascript">
$(document).ready(function(){
	$("form#create").validate();
});
</script>
<?php $this->html->scriptRegistrar() ?>
<script type="text/javascript" src="<?php echo $this->url->content("library/tiny_mce/tiny_mce.js") ?>"></script>
<script type="text/javascript" src="<?php echo $this->url->content("library/tiny_mce/plugins/imagemanager/js/mcimagemanager.js") ?>"></script>
<script type="text/javascript">
 $(document).ready(function(){
 	//TinyMCE
    // O2k7 skin (silver)
    tinyMCE.init({
    	// General options
        mode: "exact",
        elements: "content",
        theme: "advanced",
        skin: "cirkuit",
        skin_variant: "silver",
        plugins: "imagemanager,filemanager,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

        // Theme options
        theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_resizing: true,

        relative_urls : false,
    
        language: "en",

        height: "400",

        width: "100%"
     });
 });
 function openGallery(ele){
  mcImageManager.open('create', ele);
 }
</script>